package com.oneday.nuo.base.tactics.token;

import com.oneday.nuo.base.security.user.NuoUser;
import org.springframework.stereotype.Component;


public class TokenContext {
    private  TokenTactics tokenTactics;
    private  NuoUser user;


    public TokenContext(TokenTactics tokenTactics, NuoUser user){
        this.user = user;
        this.tokenTactics = tokenTactics;
    }


    public void setToken(){
        tokenTactics.setToken(user);
    }
    public NuoUser VerifyToken() {
        //验证token
        tokenTactics.verify(user.getToken());
        //获取用户信息
        return  tokenTactics.setUser(user);
    }

    public void exitLogin(){
        tokenTactics.exitLogin(user);
    }
}
